#ifndef __pump_
#define __pump_

#include "stm32f10x_conf.h"

#define START      0x02
#define SN         0x31
#define END        0x03
#define ADDR_BASE  0x31

#define CMD_SIZE 50
#define ADDR1 3
#define ADDR2 4


#define halt while(true)

//mode 1-6
//fill(manual)  prep  dose(manual) empty clean feed

typedef enum{
	kPumpFill = 1,
	kPumpPrep,

    kPumpDose,
	kPumpEmpty,
    kPumpClean,
    kPumpFeed,

	kPumpModeMax     
}PumpModeType;

typedef enum{
	kPumpInitOutToLeft,
	kPumpInitOutToRight,

    kPumpInput,
	kPumpOutput,
    kPumpUp,
    kPumpDown,
    kPumpMoveTo,
    kPumpSetSpeed,
    kPumpStop,
    kPumpUser,

    kPumpAutoStart,
    kPumpAutoStop,

	kPumpCmdMax
           
}PumpCmdType;

typedef enum{
	kPumpOne,
	kPumpTwo,

	kPumpNumMax     
}PumpNameType;

struct pump_maunual_para {
    vu16 working_state;   // pump working state
    vu16 volume_infused;  // volume

    vu32 fill_speed;
    vu32 volume;
    vu32 dose_speed;

    vu32 manual_dosing;
    vu32 manual_filling;
    vu16 mode;
    vu16 clean_times;
    vu16 feed_times;

    vu16 start_bit;
    vu16 stop_bit;
    vu16 manual_dose_bit;
};

struct pump_auto_para {
    vu32  auto_volume;
    vu32  auto_speed;
    vu16  auto_start;

};

void pump_cmd(PumpCmdType cmd, int addr, int para);
void execute_pump_cmd(PumpCmdType cmd, int para, int pump_addr);
void execute_pump_cmd_str(char *cmd_string, int pump_addr);

void foo_bar(void);

void execute_pump_auto(int fill_speed, int dose_speed, int volume, int);
void pump_event_handler_init(void);
void pump_power_on_init1(void);
void pump_power_on_init2(void);

#endif

